package net.sf.nlp.ltag.data;

import java.util.Arrays;

public class ArrayKey {
	private Object[] array;
	
	public ArrayKey(Object...args) {
		this.array = args;
	}
	
	@Override
	public boolean equals(Object obj)
	{
		if (this == obj) return true;
		if (obj instanceof ArrayKey) {
			return Arrays.deepEquals(array, ((ArrayKey)obj).array);
		} else {
			return false;
		}
	}

	@Override
	public int hashCode()
	{
		return Arrays.deepHashCode(array);
	}
	
	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		if (array == null)
			return sb.toString();
		
		for (Object obj : array)
			sb.append(obj).append(",");
		
		return sb.toString();
	}
	
}
